#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include "dominion.h"

struct gameState* testGame(){
	struct gameState* game = malloc(sizeof(struct gameState));
	return game;
}

int* cardArray = [curse, copper, silver, gold, adventurer, council_room, feast, gardens, mine, remodel, smithy, village, baron, great_hall, minion, steward, tribute, ambassador, cutpurse, embargo, outpost, salvager, sea_hag, treasure_map];

struct testAdventurer{
	int drawntreasure;
	int currentPlayer;
	int cardDrawn;
	int z;
	int temphand[MAX_HAND];
};

void generateNums(struct testAdventurer* test, struct gameState* game){
	int i;

	test->drawntreasure = rand() % 3;
	test->currentPlayer = rand() % MAX_PLAYERS;
	test->cardDrawn = cardArray[rand() % 24];
	test->z = rand() % MAX_HAND;
	for(i = 0; i< MAX_HAND; i++){
		test->temphand[i] = cardArray[rand() % 24];
	}

	game->deckCount[test->currentPlayer] = rand() % MAX_DECK;
	game->deck[test->currentPlayer] = rand() % MAX_DECK;
	game->handCount[test->currentPlayer] = rand() % MAX_HAND;
	for(i = 0; i < game->handCount[test->currentPlayer]; i++){
		game->hand[test->currentPlayer][i] = cardArray[rand() % 24];
	}
}

int main(){
	int i, numtests = 10000;
	struct gameState* game = testGame();	//create testing struct gameState
	struct testAdventurer* myTest = malloc(sizeof(struct testAdventurer));
	srand(time(NULL));  		//seed random number generator
	for(i = 0; i < numtests; i++){ 
		generateNums(myTest, game);
		zzzadvenurercardplay(myTest->drawntreasure, myTest->currentPlayer, myTest->cardDrawn, myTest->temphand, myTest->z, game);
	}
	free(game);
	free(myTest);
	return 0;
}
